using System.Collections;
using UnityEngine;
using QFramework;

namespace GameJamLight
{
    public class HitTimer : MonoSingle<HitTimer>
    {
        private bool trigger;

        public void StartHit(float time)
        {
            trigger = true;
            PublicMono.Instance.StartCoroutine(_Hit(time));
        }
        public void CloseHit()
        {
            trigger = false;
        }
        private IEnumerator _Hit(float time)
        {
            while (true)
            {
                if (!trigger) break;
                // do
                Debug.Log("Hit");
                yield return new WaitForSeconds(time);
            }
        }
    }
}